/**
 * Copyright (c) 2010-2011 Pierre Labatut
 *
 * This file is part of Space-Chronicles project.
 *
 * Space-Chronicles is free software: you can redistribute it and/or modify it
 * under the terms of its license which may be found in the accompanying
 * LICENSE file or <http://code.google.com/p/space-chronicles/>.
 */

package space.app.meshview.state;

import java.awt.event.MouseEvent;
import jinngine.math.Quaternion;

/**
 *
 * @author Pierre
 */
class RotateLightState extends AbstractRotateState {

    final Quaternion oldQuat;
    final Quaternion inverseViepoint;
    public RotateLightState(MeshCamera camera, Quaternion light, MouseEvent e) {
        super(camera, light, e);
        oldQuat = new Quaternion(light);
        inverseViepoint = camera.viewquat.inverse();        
    }

    void applyTransformation(Quaternion q1) {
        light.assign(inverseViepoint);
        light.assignMultiply(q1);
        light.assignMultiply(camera.viewquat);
        light.assignMultiply(oldQuat);
    }
}
